

\section{十大排序}

\subsection{选择排序}


\subsection{冒泡排序}


\subsection{插入排序}

\subsection{归并排序}


\subsection{堆排序}


\subsection{快速排序}



\subsection{不基于比较的排序}


\subsubsection{计数排序}

\subsubsection{基数排序}


\subsection{比较器}
Comparator接口,需要重写compare方法,返回值为int

返回-1 ,升序 0,1,2; , 1 降序, 0 表示相等的时候无所谓

\subsubsection{比较器的应用}

\begin{enumerate}
	\item  优先级队列PriorityQueue
	\textbf{数组+链表实现有序}
		
 
		\begin{tikzpicture}[node distance=0.5cm and 0cm]
			\tikzstyle{nodestyle}=[draw, rectangle, minimum size=1.0cm, inner sep=0pt]
			\tikzstyle{nodeListstyle}=[draw, circle, minimum size=0.5cm, inner sep=0pt]
			\tikzstyle{linkStyle} = [left=0.1cm,align=center]
			\tikzstyle{linkTextStyle} = [below=0.5cm,align=center]
			
			\begin{scope}
				\node [nodestyle] (n0) {1};
				\node [nodeListstyle,below=of n0] (n01) {5};
				\node [nodeListstyle,below=of n01] (n02) {8};
				\node [nodeListstyle,below=of n02] (n03) {11};
				\node [nodeListstyle,below=of n03] (n04) {19};
				\node [nodeListstyle,below=of n04] (n05) {null};
				
				\node [nodestyle,right=of n0] (n1) {2};
				\node [nodeListstyle,below=of n1] (n11) {4};
				\node [nodeListstyle,below=of n11] (n12) {6};
				\node [nodeListstyle,below=of n12] (n13) {9};
				\node [nodeListstyle,below=of n13] (n14) {22};
				\node [nodeListstyle,below=of n14] (n15) {null};
				
				\node [nodestyle,right=of n1] (n2) {3};
				\node [nodeListstyle,below=of n2] (n21) {10};
				\node [nodeListstyle,below=of n21] (n22) {14};
				\node [nodeListstyle,below=of n22] (n23) {15};
				\node [nodeListstyle,below=of n23] (n24) {17};
				\node [nodeListstyle,below=of n24] (n25) {null};
				
				\draw[->] (n0) --node[linkStyle] {next} (n01);
				\draw[->] (n01) --node[linkStyle] {next} (n02);
				\draw[->] (n02) --node[linkStyle] {next} (n03);
				\draw[->] (n03) --node[linkStyle] {next} (n04);
				\draw[->] (n04) --node[linkStyle] {next} (n05);
				
				\draw[->] (n1) --node[linkStyle] {next} (n11);
				\draw[->] (n11) --node[linkStyle] {next} (n12);
				\draw[->] (n12) --node[linkStyle] {next} (n13);
				\draw[->] (n13) --node[linkStyle] {next} (n14);
				\draw[->] (n14) --node[linkStyle] {next} (n15);
				
				\draw[->] (n2) --node[linkStyle] {next} (n21);
				\draw[->] (n21) --node[linkStyle] {next} (n22);
				\draw[->] (n22) --node[linkStyle] {next} (n23);
				\draw[->] (n23) --node[linkStyle] {next} (n24);
				\draw[->] (n24) --node[linkStyle] {next} (n25);
				\node [below=of n25]{转换后的结果为};
			\end{scope}
			
	
			\begin{scope}[yshift=-8cm,node distance=0.4cm]
	
				\node [nodeListstyle] (1) {1};
				\node [nodeListstyle,right=of 1] (2) {2};
				\node [nodeListstyle,right=of 2] (3) {3};
				\node [nodeListstyle,right=of 3] (4) {4};
				\node [nodeListstyle,right=of 4] (5) {5};
				\node [nodeListstyle,right=of 5] (6) {6};
				\node [nodeListstyle,right=of 6] (8) {8};
				\node [nodeListstyle,right=of 8] (9) {9};
				\node [nodeListstyle,right=of 9] (10) {10};
				\node [nodeListstyle,right=of 10] (11) {11};
				
				\node [nodeListstyle,right=of 11] (14) {14};
				\node [nodeListstyle,right=of 14] (15) {15};
				\node [nodeListstyle,right=of 15] (17) {17};
				
				\node [nodeListstyle,right=of 17] (19) {19};
				
				\node [nodeListstyle,right=of 19] (22) {22};
				
				\node [nodeListstyle,right=of 22] (23) {null};
				
				\draw [->] (1) --node[linkTextStyle] {next} (2);
				\draw [->] (2) --node[linkTextStyle] {next} (3);
				\draw [->] (3) --node[linkTextStyle] {next} (4);
				\draw [->] (4) --node[linkTextStyle] {next} (5);
				\draw [->] (5) --node[linkTextStyle] {next} (6);
				\draw [->] (6) --node[linkTextStyle] {next} (8);
				\draw [->] (8) --node[linkTextStyle] {next} (9);
				\draw [->] (9) --node[linkTextStyle] {next} (10);
				\draw [->] (10) --node[linkTextStyle] {next} (11);
				\draw [->] (11) --node[linkTextStyle] {next} (14);
				\draw [->] (14) --node[linkTextStyle] {next} (15);
				\draw [->] (15) --node[linkTextStyle] {next} (17);
				\draw [->] (17) --node[linkTextStyle] {next} (19);
				\draw [->] (19) --node[linkTextStyle] {next} (22);
				\draw [->] (22) --node[linkTextStyle] {next} (23);

			\end{scope}
		\end{tikzpicture}
	\item   TreeSet有序集合
	\item  TreeMap有序Map
\end{enumerate}